<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
 session_start();

 include("../main/function.php");
 include("../main/ShowPage.class.php");

 $db=new Db();
 
 $username=$_POST['username'];
 $password=$_POST['password'];
 $idcard=$_POST['idcard'];
 if($username=='' || $password=='' || $idcard==''){
		echo "<script>alert('请检测填写的信息是否正确');history.back();</script>"; 
 }
 else
 {
  $password=md5($password);
 
 $sql="INSERT INTO `teacher_user` (`id`, `username`, `password`, `idcard`, `state`) VALUES (NULL, '$username', '$password', '$idcard', '1');";
 //exit($sql);
 $state=$db->query($sql);
 //echo "select * from area where fid='$id' order by id";
 if($state){
 	exit("<script>alert('注册成功，请登录！');window.close();</script>");
 }else{
 	exit("<script>alert('注册失败，请重试！');history.back();</script>");
 }
	 
}

 
?>










